getSplits.wikifolio <- function (symbol, user="va", dbname="va_wikifolio", host="localhost", 
                                    datefrom="2000-01-01", dateto=NULL) {
  # connect to database
  con <- connectToVadb(user=user, dbname=dbname, host=host)
  
  sql <- sprintf("SELECT date,ratio 
                    FROM stockname LEFT JOIN splits ON (id=stock_id) WHERE symbol='%s'", symbol)
  if (!is.null(datefrom)) {
    sql <- paste (sql, sprintf ("AND date>='%s'", datefrom))
  }
  if (!is.null(dateto)) {
    sql <- paste (sql, sprintf ("AND date<='%s'", dateto))
  }
  sql <- paste (sql,"ORDER BY `date`")
  
  split <- dbGetQuery(con, sql)
  if (nrow(split) > 0)  {
    split <- xts(split[,-1], as.Date(split$date, tz="UTC"))
    colnames(split) <- paste(symbol, "split", sep=".")
  } else {
    split <- NA
  }
  
  dbDisconnect(con)
  return (split)
}